﻿/**
* ...
* @author Default
*/

class arkadium.Timer {
	
	private var _nInterval:Number;
	private var _mcTimer:MovieClip;
	private var _fCallBack:Function;
	
	public function Timer(mc:MovieClip, time:Number, callBack:Function) {
	trace(time);
		_nInterval = setInterval(this, "nextFrame", time / 500 * 1000);
	
		_mcTimer = mc;
		_fCallBack = callBack;
	}
	
	public function nextFrame () {
		
		if (_mcTimer._currentframe < 499) {
			_mcTimer.nextFrame();
			_mcTimer._smcSparks.nextFrame();
		} else {
			clearInterval(_nInterval);
			_fCallBack();
		}
		
	}
	
	public function stop() {
		clearInterval(_nInterval);
		if (_mcTimer._currentframe <= 165) {
			return true;
			_mcTimer._smcBonus.gotoAndPlay (22);
		}
		
		return false;
	}
	
}